summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-01-05 09:38:07 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-01-05 12:17:53 +0100
commit061cd28751cd7c3bf900ed9172f0739089473814 (patch)
treed837d652c2a0834ba29d5ba1bc4c557178618120
Created QtJSBackend module.
Imported src/v8, tools and tests from qtbase (1fdfc2abfe1fa26b86028934d4853432e25b4655) and added the necessary build system files to build it as a top-level Qt module. Change-Id: I0b784165157bfb031059f1528c1b3b2828284f6f
-rw-r--r--.gitignore4
-rw-r--r--qtjsbackend.pro14
-rw-r--r--src/modules/qt_v8.pri16
-rw-r--r--src/src.pro2
-rw-r--r--src/tools/mkv8snapshot/mkv8snapshot.pro39
-rw-r--r--src/v8/v8.pri307
-rw-r--r--src/v8/v8.pro41
-rw-r--r--src/v8/v8base.pri24
-rw-r--r--sync.profile26
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/v8/Makefile.nonqt16
-rw-r--r--tests/auto/v8/README.txt13
-rw-r--r--tests/auto/v8/tst_v8.cpp98
-rw-r--r--tests/auto/v8/v8.pro10
-rw-r--r--tests/auto/v8/v8main.cpp66
-rw-r--r--tests/auto/v8/v8test.cpp379
-rw-r--r--tests/auto/v8/v8test.h58
-rw-r--r--tests/tests.pro2
18 files changed, 1117 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..201a58f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+# This file is used to ignore files which are generated in the Qt build system
+# ----------------------------------------------------------------------------
+src/v8/qtv8version.h
+src/v8/generated-debug/
diff --git a/qtjsbackend.pro b/qtjsbackend.pro
new file mode 100644
index 0000000..b2c9a10
--- /dev/null
+++ b/qtjsbackend.pro
@@ -0,0 +1,14 @@
+TEMPLATE = subdirs
+
+module_qtjsbackend_src.subdir = src
+module_qtjsbackend_src.target = module-qtjsbackend-src
+
+module_qtjsbackend_tests.subdir = tests
+module_qtjsbackend_tests.target = module-qtjsbackend-tests
+module_qtjsbackend_tests.depends = module_qtjsbackend_src
+module_qtjsbackend_tests.CONFIG = no_default_install
+!contains(QT_BUILD_PARTS,tests):module_qtjsbackend_tests.CONFIG += no_default_target
+
+SUBDIRS += module_qtjsbackend_src \
+ module_qtjsbackend_tests
+
diff --git a/src/modules/qt_v8.pri b/src/modules/qt_v8.pri
new file mode 100644
index 0000000..89d6c26
--- /dev/null
+++ b/src/modules/qt_v8.pri
@@ -0,0 +1,16 @@
+QT.v8.VERSION = 5.0.0
+QT.v8.MAJOR_VERSION = 5
+QT.v8.MINOR_VERSION = 0
+QT.v8.PATCH_VERSION = 0
+
+QT.v8.name = QtV8
+QT.v8.bins = $$QT_MODULE_BIN_BASE
+QT.v8.includes = $$QT_MODULE_INCLUDE_BASE/QtV8
+QT.v8.private_includes = $$QT_MODULE_INCLUDE_BASE/QtV8/$$QT.v8.VERSION
+QT.v8.sources = $$QT_MODULE_BASE/src/v8
+QT.v8.libs = $$QT_MODULE_LIB_BASE
+QT.v8.plugins = $$QT_MODULE_PLUGIN_BASE
+QT.v8.imports = $$QT_MODULE_IMPORT_BASE
+QT.v8.depends =
+QT.v8.DEFINES =
+!contains(QT_CONFIG, static): QT.v8.DEFINES += V8_SHARED USING_V8_SHARED
diff --git a/src/src.pro b/src/src.pro
new file mode 100644
index 0000000..5d6dc20
--- /dev/null
+++ b/src/src.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = v8
diff --git a/src/tools/mkv8snapshot/mkv8snapshot.pro b/src/tools/mkv8snapshot/mkv8snapshot.pro
new file mode 100644
index 0000000..41fa5df
--- /dev/null
+++ b/src/tools/mkv8snapshot/mkv8snapshot.pro
@@ -0,0 +1,39 @@
+TEMPLATE = app
+TARGET = mkv8snapshot
+QT =
+CONFIG -= app_bundle
+CONFIG -= qt
+CONFIG += console
+CONFIG += warn_off
+
+DESTDIR = ../../../bin
+INCLUDEPATH += .
+DEPENDPATH += .
+LIBS =
+OBJECTS_DIR = .
+
+contains(QT_CONFIG, build_all): CONFIG += build_all
+win32|mac:!macx-xcode: CONFIG += debug_and_release
+
+TARGET = $$TARGET$$qtPlatformTargetSuffix()
+
+cross_compile {
+ equals(QT_ARCH, arm): V8_TARGET_ARCH = arm
+}
+
+include(../../v8/v8.pri)
+
+cross_compile {
+ equals(V8_TARGET_ARCH, arm): SOURCES += $$V8SRC/arm/simulator-arm.cc
+}
+
+SOURCES += \
+ $$V8SRC/snapshot-empty.cc \
+ $$V8SRC/mksnapshot.cc
+
+unix:LIBS += -lpthread
+
+# We don't need to install this tool, it's only used for building v8.
+# However we do have to make sure that 'make install' builds it.
+dummytarget.CONFIG = dummy_install
+INSTALLS += dummytarget
diff --git a/src/v8/v8.pri b/src/v8/v8.pri
new file mode 100644
index 0000000..530b2a7
--- /dev/null
+++ b/src/v8/v8.pri
@@ -0,0 +1,307 @@
+isEmpty(QT_ARCH) {
+ # We're most likely being parsed in a fromfile() call, in which case the
+ # QMake environment isn't complete. Load qt_config in an attempt to set
+ # the variables we need (QT_ARCH and CONFIG, in particular).
+ load(qt_config)
+}
+
+isEmpty(V8_TARGET_ARCH) {
+ # Detect target
+ equals(QT_ARCH, x86_64)|contains(CONFIG, x86_64):V8_TARGET_ARCH = x64
+ else:equals(QT_ARCH, "i386"): V8_TARGET_ARCH = ia32
+ else:equals(QT_ARCH, "mips"): V8_TARGET_ARCH = mips
+ else:equals(QT_ARCH, "arm"): V8_TARGET_ARCH = arm
+ else:equals(QMAKE_HOST.arch, armv7l): V8_TARGET_ARCH = arm
+ else:equals(QMAKE_HOST.arch, armv5tel): V8_TARGET_ARCH = arm
+ else:equals(QMAKE_HOST.arch, x86_64): V8_TARGET_ARCH = x64
+ else:equals(QMAKE_HOST.arch, x86): V8_TARGET_ARCH = ia32
+ else:equals(QMAKE_HOST.arch, i386): V8_TARGET_ARCH = ia32
+ else:equals(QMAKE_HOST.arch, i686): V8_TARGET_ARCH = ia32
+ else:error("Couldn't detect supported v8 architecture ($$QMAKE_HOST.arch/$$QT_ARCH). Currently supported architectures are: x64, x86 and arm")
+}
+
+include($$PWD/v8base.pri)
+
+# In debug-and-release builds, generated sources must not go to the same
+# directory, or they could clobber each other in highly parallelized builds
+CONFIG(debug, debug|release):V8_GENERATED_SOURCES_DIR = generated-debug
+else: V8_GENERATED_SOURCES_DIR = generated-release
+
+# this maybe removed in future
+DEFINES += ENABLE_DEBUGGER_SUPPORT
+
+# this is needed by crankshaft ( http://code.google.com/p/v8/issues/detail?id=1271 )
+DEFINES += ENABLE_VMSTATE_TRACKING ENABLE_LOGGING_AND_PROFILING
+
+CONFIG(debug, debug|release) {
+ DEFINES += DEBUG V8_ENABLE_CHECKS OBJECT_PRINT ENABLE_DISASSEMBLER
+} else {
+ DEFINES += NDEBUG
+}
+
+V8SRC = $$V8DIR/src
+
+INCLUDEPATH += \
+ $$V8SRC
+
+SOURCES += \
+ $$V8SRC/accessors.cc \
+ $$V8SRC/allocation.cc \
+ $$V8SRC/api.cc \
+ $$V8SRC/assembler.cc \
+ $$V8SRC/ast.cc \
+ $$V8SRC/atomicops_internals_x86_gcc.cc \
+ $$V8SRC/bignum.cc \
+ $$V8SRC/bignum-dtoa.cc \
+ $$V8SRC/bootstrapper.cc \
+ $$V8SRC/builtins.cc \
+ $$V8SRC/cached-powers.cc \
+ $$V8SRC/checks.cc \
+ $$V8SRC/circular-queue.cc \
+ $$V8SRC/code-stubs.cc \
+ $$V8SRC/codegen.cc \
+ $$V8SRC/compilation-cache.cc \
+ $$V8SRC/compiler.cc \
+ $$V8SRC/contexts.cc \
+ $$V8SRC/conversions.cc \
+ $$V8SRC/counters.cc \
+ $$V8SRC/cpu-profiler.cc \
+ $$V8SRC/data-flow.cc \
+ $$V8SRC/dateparser.cc \
+ $$V8SRC/debug-agent.cc \
+ $$V8SRC/debug.cc \
+ $$V8SRC/deoptimizer.cc \
+ $$V8SRC/disassembler.cc \
+ $$V8SRC/diy-fp.cc \
+ $$V8SRC/dtoa.cc \
+ $$V8SRC/elements.cc \
+ $$V8SRC/execution.cc \
+ $$V8SRC/factory.cc \
+ $$V8SRC/flags.cc \
+ $$V8SRC/frames.cc \
+ $$V8SRC/full-codegen.cc \
+ $$V8SRC/func-name-inferrer.cc \
+ $$V8SRC/gdb-jit.cc \
+ $$V8SRC/global-handles.cc \
+ $$V8SRC/fast-dtoa.cc \
+ $$V8SRC/fixed-dtoa.cc \
+ $$V8SRC/handles.cc \
+ $$V8SRC/hashmap.cc \
+ $$V8SRC/heap-profiler.cc \
+ $$V8SRC/heap.cc \
+ $$V8SRC/hydrogen.cc \
+ $$V8SRC/hydrogen-instructions.cc \
+ $$V8SRC/ic.cc \
+ $$V8SRC/incremental-marking.cc \
+ $$V8SRC/inspector.cc \
+ $$V8SRC/interpreter-irregexp.cc \
+ $$V8SRC/isolate.cc \
+ $$V8SRC/jsregexp.cc \
+ $$V8SRC/lithium-allocator.cc \
+ $$V8SRC/lithium.cc \
+ $$V8SRC/liveedit.cc \
+ $$V8SRC/liveobjectlist.cc \
+ $$V8SRC/log-utils.cc \
+ $$V8SRC/log.cc \
+ $$V8SRC/mark-compact.cc \
+ $$V8SRC/messages.cc \
+ $$V8SRC/objects.cc \
+ $$V8SRC/objects-printer.cc \
+ $$V8SRC/objects-visiting.cc \
+ $$V8SRC/parser.cc \
+ $$V8SRC/preparser.cc \
+ $$V8SRC/preparse-data.cc \
+ $$V8SRC/profile-generator.cc \
+ $$V8SRC/property.cc \
+ $$V8SRC/regexp-macro-assembler-irregexp.cc \
+ $$V8SRC/regexp-macro-assembler.cc \
+ $$V8SRC/regexp-stack.cc \
+ $$V8SRC/rewriter.cc \
+ $$V8SRC/runtime.cc \
+ $$V8SRC/runtime-profiler.cc \
+ $$V8SRC/safepoint-table.cc \
+ $$V8SRC/scanner.cc \
+ $$V8SRC/scanner-character-streams.cc \
+ $$V8SRC/scopeinfo.cc \
+ $$V8SRC/scopes.cc \
+ $$V8SRC/serialize.cc \
+ $$V8SRC/snapshot-common.cc \
+ $$V8SRC/spaces.cc \
+ $$V8SRC/string-search.cc \
+ $$V8SRC/string-stream.cc \
+ $$V8SRC/strtod.cc \
+ $$V8SRC/stub-cache.cc \
+ $$V8SRC/token.cc \
+ $$V8SRC/type-info.cc \
+ $$V8SRC/unicode.cc \
+ $$V8SRC/utils.cc \
+ $$V8SRC/v8-counters.cc \
+ $$V8SRC/v8.cc \
+ $$V8SRC/v8conversions.cc \
+ $$V8SRC/v8threads.cc \
+ $$V8SRC/v8utils.cc \
+ $$V8SRC/variables.cc \
+ $$V8SRC/version.cc \
+ $$V8SRC/store-buffer.cc \
+ $$V8SRC/zone.cc \
+ $$V8SRC/extensions/gc-extension.cc \
+ $$V8SRC/extensions/externalize-string-extension.cc
+
+equals(V8_TARGET_ARCH, arm) {
+DEFINES += V8_TARGET_ARCH_ARM
+DEFINES += USE_EABI_HARDFLOAT=1 CAN_USE_VFP_INSTRUCTIONS
+SOURCES += \
+ $$V8SRC/arm/builtins-arm.cc \
+ $$V8SRC/arm/code-stubs-arm.cc \
+ $$V8SRC/arm/codegen-arm.cc \
+ $$V8SRC/arm/constants-arm.cc \
+ $$V8SRC/arm/cpu-arm.cc \
+ $$V8SRC/arm/debug-arm.cc \
+ $$V8SRC/arm/deoptimizer-arm.cc \
+ $$V8SRC/arm/disasm-arm.cc \
+ $$V8SRC/arm/frames-arm.cc \
+ $$V8SRC/arm/full-codegen-arm.cc \
+ $$V8SRC/arm/ic-arm.cc \
+ $$V8SRC/arm/lithium-arm.cc \
+ $$V8SRC/arm/lithium-codegen-arm.cc \
+ $$V8SRC/arm/lithium-gap-resolver-arm.cc \
+ $$V8SRC/arm/macro-assembler-arm.cc \
+ $$V8SRC/arm/regexp-macro-assembler-arm.cc \
+ $$V8SRC/arm/stub-cache-arm.cc \
+ $$V8SRC/arm/assembler-arm.cc
+} else:equals(V8_TARGET_ARCH, ia32) {
+DEFINES += V8_TARGET_ARCH_IA32
+SOURCES += \
+ $$V8SRC/ia32/assembler-ia32.cc \
+ $$V8SRC/ia32/builtins-ia32.cc \
+ $$V8SRC/ia32/code-stubs-ia32.cc \
+ $$V8SRC/ia32/codegen-ia32.cc \
+ $$V8SRC/ia32/cpu-ia32.cc \
+ $$V8SRC/ia32/debug-ia32.cc \
+ $$V8SRC/ia32/deoptimizer-ia32.cc \
+ $$V8SRC/ia32/disasm-ia32.cc \
+ $$V8SRC/ia32/frames-ia32.cc \
+ $$V8SRC/ia32/full-codegen-ia32.cc \
+ $$V8SRC/ia32/ic-ia32.cc \
+ $$V8SRC/ia32/lithium-codegen-ia32.cc \
+ $$V8SRC/ia32/lithium-gap-resolver-ia32.cc \
+ $$V8SRC/ia32/lithium-ia32.cc \
+ $$V8SRC/ia32/macro-assembler-ia32.cc \
+ $$V8SRC/ia32/regexp-macro-assembler-ia32.cc \
+ $$V8SRC/ia32/stub-cache-ia32.cc
+} else:equals(V8_TARGET_ARCH, x64) {
+# FIXME What about 32-bit Macs?
+DEFINES += V8_TARGET_ARCH_X64
+SOURCES += \
+ $$V8SRC/x64/assembler-x64.cc \
+ $$V8SRC/x64/builtins-x64.cc \
+ $$V8SRC/x64/code-stubs-x64.cc \
+ $$V8SRC/x64/codegen-x64.cc \
+ $$V8SRC/x64/cpu-x64.cc \
+ $$V8SRC/x64/debug-x64.cc \
+ $$V8SRC/x64/deoptimizer-x64.cc \
+ $$V8SRC/x64/disasm-x64.cc \
+ $$V8SRC/x64/frames-x64.cc \
+ $$V8SRC/x64/full-codegen-x64.cc \
+ $$V8SRC/x64/ic-x64.cc \
+ $$V8SRC/x64/lithium-codegen-x64.cc \
+ $$V8SRC/x64/lithium-gap-resolver-x64.cc \
+ $$V8SRC/x64/lithium-x64.cc \
+ $$V8SRC/x64/macro-assembler-x64.cc \
+ $$V8SRC/x64/regexp-macro-assembler-x64.cc \
+ $$V8SRC/x64/stub-cache-x64.cc
+} else:equals(V8_TARGET_ARCH, mips) {
+DEFINES += V8_TARGET_MIPS
+SOURCES += \
+ $$V8SRC/mips/assembler-mips.cc \
+ $$V8SRC/mips/builtins-mips.cc \
+ $$V8SRC/mips/codegen-mips.cc \
+ $$V8SRC/mips/code-stubs-mips.cc \
+ $$V8SRC/mips/constants-mips.cc \
+ $$V8SRC/mips/cpu-mips.cc \
+ $$V8SRC/mips/debug-mips.cc \
+ $$V8SRC/mips/deoptimizer-mips.cc \
+ $$V8SRC/mips/disasm-mips.cc \
+ $$V8SRC/mips/frames-mips.cc \
+ $$V8SRC/mips/full-codegen-mips.cc \
+ $$V8SRC/mips/ic-mips.cc \
+ $$V8SRC/mips/macro-assembler-mips.cc \
+ $$V8SRC/mips/regexp-macro-assembler-mips.cc \
+ $$V8SRC/mips/simulator-mips.cc \
+ $$V8SRC/mips/stub-cache-mips.cc
+}
+
+#os:macos
+macx {
+SOURCES += \
+ $$V8SRC/platform-macos.cc \
+ $$V8SRC/platform-posix.cc
+} else:freebsd-* {
+SOURCES += \
+ $$V8SRC/platform-freebsd.cc \
+ $$V8SRC/platform-posix.cc
+LIBS += -lexecinfo
+} else:unix:!symbian {
+SOURCES += \
+ $$V8SRC/platform-linux.cc \
+ $$V8SRC/platform-posix.cc
+}
+
+win32 {
+SOURCES += \
+ $$V8SRC/platform-win32.cc \
+ $$V8SRC/win32-math.cc
+LIBS += -lWs2_32 -lWinmm
+win32-msvc*: QMAKE_CXXFLAGS += -wd4100 -wd 4291 -wd4351 -wd4355 -wd4800
+win32-msvc*:arch_i386: DEFINES += _USE_32BIT_TIME_T
+}
+
+#mode:debug
+CONFIG(debug) {
+ SOURCES += \
+ $$V8SRC/objects-debug.cc \
+ $$V8SRC/prettyprinter.cc \
+ $$V8SRC/regexp-macro-assembler-tracer.cc
+}
+
+V8_LIBRARY_FILES = \
+ $$V8SRC/runtime.js \
+ $$V8SRC/v8natives.js \
+ $$V8SRC/array.js \
+ $$V8SRC/string.js \
+ $$V8SRC/uri.js \
+ $$V8SRC/math.js \
+ $$V8SRC/messages.js \
+ $$V8SRC/apinatives.js \
+ $$V8SRC/date.js \
+ $$V8SRC/regexp.js \
+ $$V8SRC/json.js \
+ $$V8SRC/liveedit-debugger.js \
+ $$V8SRC/mirror-debugger.js \
+ $$V8SRC/debug-debugger.js
+
+V8_EXPERIMENTAL_LIBRARY_FILES = \
+ $$V8SRC/proxy.js \
+
+v8_js2c.commands = python $$V8DIR/tools/js2c.py $$V8_GENERATED_SOURCES_DIR/libraries.cpp CORE off
+v8_js2c.commands += $$V8SRC/macros.py ${QMAKE_FILE_IN}
+v8_js2c.output = $$V8_GENERATED_SOURCES_DIR/libraries.cpp
+v8_js2c.input = V8_LIBRARY_FILES
+v8_js2c.variable_out = SOURCES
+v8_js2c.dependency_type = TYPE_C
+v8_js2c.depends = $$V8DIR/tools/js2c.py $$V8SRC/macros.py
+v8_js2c.CONFIG += combine
+v8_js2c.name = generating[v8] ${QMAKE_FILE_IN}
+silent:v8_js2c.commands = @echo generating[v8] ${QMAKE_FILE_IN} && $$v8_js2c.commands
+
+v8_js2c_experimental.commands = python $$V8DIR/tools/js2c.py $$V8_GENERATED_SOURCES_DIR/experimental-libraries.cpp EXPERIMENTAL off
+v8_js2c_experimental.commands += $$V8SRC/macros.py ${QMAKE_FILE_IN}
+v8_js2c_experimental.output = $$V8_GENERATED_SOURCES_DIR/experimental-libraries.cpp
+v8_js2c_experimental.input = V8_EXPERIMENTAL_LIBRARY_FILES
+v8_js2c_experimental.variable_out = SOURCES
+v8_js2c_experimental.dependency_type = TYPE_C
+v8_js2c_experimental.depends = $$V8DIR/tools/js2c.py $$V8SRC/macros.py
+v8_js2c_experimental.CONFIG += combine
+v8_js2c_experimental.name = generating[v8] ${QMAKE_FILE_IN}
+
+QMAKE_EXTRA_COMPILERS += v8_js2c v8_js2c_experimental
diff --git a/src/v8/v8.pro b/src/v8/v8.pro
new file mode 100644
index 0000000..c71d32b
--- /dev/null
+++ b/src/v8/v8.pro
@@ -0,0 +1,41 @@
+load(qt_module)
+
+TARGET = QtV8
+QPRO_PWD = $$PWD
+QT =
+
+CONFIG += module
+MODULE_PRI = ../modules/qt_v8.pri
+
+win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
+
+load(qt_module_config)
+CONFIG += warn_off
+
+# Remove includepaths that were added by qt_module_config.
+# These cause compilation of V8 to fail because they appear before
+# 3rdparty/v8/src; 3rdparty/v8/src/v8.h will then be "shadowed" by
+# the public v8.h API header (they are not the same!).
+INCLUDEPATH -= $$MODULE_PRIVATE_INCLUDES
+INCLUDEPATH -= $$MODULE_PRIVATE_INCLUDES/$$TARGET
+INCLUDEPATH -= $$MODULE_INCLUDES $$MODULE_INCLUDES/..
+
+HEADERS += qtv8version.h
+
+!contains(QT_CONFIG, static): DEFINES += V8_SHARED BUILDING_V8_SHARED
+
+include(v8.pri)
+
+contains(QT_CONFIG, v8snapshot) {
+ mkv8snapshot.commands = ../../bin/mkv8snapshot$$qtPlatformTargetSuffix() ${QMAKE_FILE_OUT}
+ DUMMY_FILE = v8.pro
+ mkv8snapshot.input = DUMMY_FILE
+ mkv8snapshot.output = $$V8_GENERATED_SOURCES_DIR/snapshot.cpp
+ mkv8snapshot.variable_out = SOURCES
+ mkv8snapshot.dependency_type = TYPE_C
+ mkv8snapshot.name = generating[v8] ${QMAKE_FILE_IN}
+ silent:mkv8snapshot.commands = @echo generating[v8] ${QMAKE_FILE_IN} && $$mkv8snapshot.commands
+ QMAKE_EXTRA_COMPILERS += mkv8snapshot
+} else {
+ SOURCES += $$V8SRC/snapshot-empty.cc
+}
diff --git a/src/v8/v8base.pri b/src/v8/v8base.pri
new file mode 100644
index 0000000..8a7d18c
--- /dev/null
+++ b/src/v8/v8base.pri
@@ -0,0 +1,24 @@
+V8DIR = $$(V8DIR)
+isEmpty(V8DIR) {
+ V8DIR = $$PWD/../3rdparty/v8
+ !exists($$V8DIR/src):error("$$V8DIR/src does not exist! $$escape_expand(\\n)\
+ If you are building from git, please ensure you have the v8 submodule available, e.g. $$escape_expand(\\n\\n)\
+ git submodule update --init src/3rdparty/v8 $$escape_expand(\\n\\n)\
+ Alternatively, Qt may be configured with -no-v8 to disable v8.\
+ ")
+} else {
+ message(using external V8 from $$V8DIR)
+}
+
+*-g++*: {
+ QMAKE_CFLAGS_WARN_ON += -Wno-unused-parameter
+ QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
+
+ # mksnapshot hangs if gcc 4.5 is used
+ # for reference look at http://code.google.com/p/v8/issues/detail?id=884
+ equals(QT_GCC_MAJOR_VERSION, 4): equals(QT_GCC_MINOR_VERSION, 5) {
+ message(because of a bug in gcc / v8 we need to add -fno-strict-aliasing)
+ QMAKE_CFLAGS += -fno-strict-aliasing
+ QMAKE_CXXFLAGS += -fno-strict-aliasing
+ }
+}
diff --git a/sync.profile b/sync.profile
new file mode 100644
index 0000000..7a88ec1
--- /dev/null
+++ b/sync.profile
@@ -0,0 +1,26 @@
+%modules = ( # path to module name map
+ "QtV8" => "$basedir/src/v8",
+);
+%moduleheaders = ( # restrict the module headers to those found in relative path
+ "QtV8" => "../3rdparty/v8/include",
+);
+@allmoduleheadersprivate = (
+ "QtV8"
+);
+%classnames = (
+ "qtv8version.h" => "QtV8Version",
+);
+%mastercontent = ();
+%modulepris = (
+ "QtV8" => "$basedir/src/modules/qt_v8.pri",
+);
+
+# Module dependencies.
+# Every module that is required to build this module should have one entry.
+# Each of the module version specifiers can take one of the following values:
+# - A specific Git revision.
+# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
+#
+%dependencies = (
+ "qtbase" => "refs/heads/master",
+);
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
new file mode 100644
index 0000000..5d6dc20
--- /dev/null
+++ b/tests/auto/auto.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = v8
diff --git a/tests/auto/v8/Makefile.nonqt b/tests/auto/v8/Makefile.nonqt
new file mode 100644
index 0000000..ded1ba3
--- /dev/null
+++ b/tests/auto/v8/Makefile.nonqt
@@ -0,0 +1,16 @@
+V8PATH = ../../../src/3rdparty/v8
+V8LIBPATH = $(V8PATH)
+V8INCPATH = $(V8PATH)/include
+SOURCES = v8main.cpp v8test.cpp
+
+release-m32:
+ g++ -o v8test_release_m32 -m32 -O2 -I$(V8INCPATH) $(SOURCES) -lpthread -L$(V8LIBPATH) -lv8
+
+debug-m32:
+ g++ -o v8test_debug_m32 -m32 -g -I$(V8INCPATH) $(SOURCES) -lpthread -L$(V8LIBPATH) -lv8_g
+
+release:
+ g++ -o v8test_release -O2 -I$(V8INCPATH) $(SOURCES) -lpthread -L$(V8LIBPATH) -lv8
+
+debug:
+ g++ -o v8test_debug -g -I$(V8INCPATH) $(SOURCES) -lpthread -L$(V8LIBPATH) -lv8_g
diff --git a/tests/auto/v8/README.txt b/tests/auto/v8/README.txt
new file mode 100644
index 0000000..097c459
--- /dev/null
+++ b/tests/auto/v8/README.txt
@@ -0,0 +1,13 @@
+The v8 tests are actually implemented in v8test.[h|cpp]. There are also QtTest
+(tst_v8.cpp) and non-Qt (v8main.cpp) stubs provided to run these tests. This
+is done to allow the tests to be run both in the Qt CI system, and manually
+without a build of Qt. The latter is necessary to run them against more exotic
+build of V8, like the ARM simulator.
+
+To build the non-Qt version of the tests, first build a debug or release V8
+library under src/3rdparty/v8 using scons, and then use the Makefile.nonqt
+makefile selecting one of the following targets:
+ release: Build the tests with -O2 and link against libv8
+ debug: Build the tests with -g and link against libv8_g
+ release-m32: Build the tests with -O2 -m32 and link against libv8
+ debug-m32: Build the tests with -g -m32 and link against libv8_g
diff --git a/tests/auto/v8/tst_v8.cpp b/tests/auto/v8/tst_v8.cpp
new file mode 100644
index 0000000..bb3184c
--- /dev/null
+++ b/tests/auto/v8/tst_v8.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <private/v8.h>
+#include "v8test.h"
+
+using namespace v8;
+
+class tst_v8 : public QObject
+{
+ Q_OBJECT
+public:
+ tst_v8() {}
+
+private slots:
+ void initTestCase() {}
+ void cleanupTestCase() {}
+
+ void eval();
+ void evalwithinwith();
+ void userobjectcompare();
+ void externalteardown();
+ void globalcall();
+};
+
+void tst_v8::eval()
+{
+ QVERIFY(v8test_eval());
+}
+
+void tst_v8::evalwithinwith()
+{
+ QVERIFY(v8test_evalwithinwith());
+}
+
+void tst_v8::userobjectcompare()
+{
+ QVERIFY(v8test_userobjectcompare());
+}
+
+void tst_v8::externalteardown()
+{
+ QVERIFY(v8test_externalteardown());
+}
+
+void tst_v8::globalcall()
+{
+ QVERIFY(v8test_globalcall());
+}
+
+int main(int argc, char *argv[])
+{
+ V8::SetFlagsFromCommandLine(&argc, argv, true);
+
+ QCoreApplication app(argc, argv);
+ tst_v8 tc;
+ return QTest::qExec(&tc, argc, argv);
+}
+
+#include "tst_v8.moc"
diff --git a/tests/auto/v8/v8.pro b/tests/auto/v8/v8.pro
new file mode 100644
index 0000000..493ea8e
--- /dev/null
+++ b/tests/auto/v8/v8.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_v8
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_v8.cpp v8test.cpp
+HEADERS += v8test.h
+
+CONFIG += parallel_test
+
+QT = core v8-private testlib
diff --git a/tests/auto/v8/v8main.cpp b/tests/auto/v8/v8main.cpp
new file mode 100644
index 0000000..f8ffea0
--- /dev/null
+++ b/tests/auto/v8/v8main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "v8test.h"
+#include <stdio.h>
+#include <strings.h>
+
+#define RUN_TEST(testname) { \
+ if (argc == 1 || 0 == ::strcmp(argv[1], # testname)) { \
+ if (!v8test_ ## testname()) \
+ printf ("Test %s FAILED\n", # testname); \
+ else \
+ printf ("Test %s PASS\n", # testname); \
+ } \
+}
+
+int main(int argc, char *argv[])
+{
+ v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
+
+ RUN_TEST(eval);
+ RUN_TEST(evalwithinwith);
+ RUN_TEST(userobjectcompare);
+ RUN_TEST(externalteardown);
+ RUN_TEST(globalcall);
+
+ return -1;
+}
diff --git a/tests/auto/v8/v8test.cpp b/tests/auto/v8/v8test.cpp
new file mode 100644
index 0000000..5576f47
--- /dev/null
+++ b/tests/auto/v8/v8test.cpp
@@ -0,0 +1,379 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "v8test.h"
+
+using namespace v8;
+
+#define BEGINTEST() bool _testPassed = true;
+#define ENDTEST() return _testPassed;
+
+#define VERIFY(expr) { \
+ if (!(expr)) { \
+ fprintf(stderr, "FAIL: %s:%d %s\n", __FILE__, __LINE__, # expr); \
+ _testPassed = false; \
+ goto cleanup; \
+ } \
+}
+
+struct MyStringResource : public String::ExternalAsciiStringResource
+{
+ static bool wasDestroyed;
+ virtual ~MyStringResource() { wasDestroyed = true; }
+ virtual const char* data() const { return "v8test"; }
+ virtual size_t length() const { return 6; }
+};
+bool MyStringResource::wasDestroyed = false;
+
+struct MyResource : public Object::ExternalResource
+{
+ static bool wasDestroyed;
+ virtual ~MyResource() { wasDestroyed = true; }
+};
+bool MyResource::wasDestroyed = false;
+
+bool v8test_externalteardown()
+{
+ BEGINTEST();
+
+ Isolate *isolate = v8::Isolate::New();
+ isolate->Enter();
+
+ {
+ HandleScope handle_scope;
+ Persistent<Context> context = Context::New();
+ Context::Scope context_scope(context);
+
+ String::NewExternal(new MyStringResource);
+
+ Local<FunctionTemplate> ft = FunctionTemplate::New();
+ ft->InstanceTemplate()->SetHasExternalResource(true);
+
+ Local<Object> obj = ft->GetFunction()->NewInstance();
+ obj->SetExternalResource(new MyResource);
+
+ context.Dispose();
+ }
+
+ // while (!v8::V8::IdleNotification()) ;
+ isolate->Exit();
+ isolate->Dispose();
+
+ // ExternalString resources aren't guaranteed to be freed by v8 at this
+ // point. Uncommenting the IdleNotification() line above helps.
+// VERIFY(MyStringResource::wasDestroyed);
+
+ VERIFY(MyResource::wasDestroyed);
+
+cleanup:
+
+ ENDTEST();
+}
+
+bool v8test_eval()
+{
+ BEGINTEST();
+
+ HandleScope handle_scope;
+ Persistent<Context> context = Context::New();
+ Context::Scope context_scope(context);
+
+ Local<Object> qmlglobal = Object::New();
+ qmlglobal->Set(String::New("a"), Integer::New(1922));
+
+ Local<Script> script = Script::Compile(String::New("eval(\"a\")"), NULL, NULL,
+ Handle<String>(), Script::QmlMode);
+
+ TryCatch tc;
+ Local<Value> result = script->Run(qmlglobal);
+
+ VERIFY(!tc.HasCaught());
+ VERIFY(result->Int32Value() == 1922);
+
+cleanup:
+ context.Dispose();
+
+ ENDTEST();
+}
+
+bool v8test_globalcall()
+{
+ BEGINTEST();
+
+ HandleScope handle_scope;
+ Persistent<Context> context = Context::New();
+ Context::Scope context_scope(context);
+
+ Local<Object> qmlglobal = Object::New();
+
+#define SOURCE "function func1() { return 1; }\n" \
+ "function func2() { var sum = 0; for (var ii = 0; ii < 10000000; ++ii) { sum += func1(); } return sum; }\n" \
+ "func2();"
+
+ Local<Script> script = Script::Compile(String::New(SOURCE), NULL, NULL,
+ Handle<String>(), Script::QmlMode);
+ Local<Value> result = script->Run(qmlglobal);
+ VERIFY(!result.IsEmpty());
+ VERIFY(result->IsInt32());
+ VERIFY(result->Int32Value() == 10000000);
+
+#undef SOURCE
+
+cleanup:
+ context.Dispose();
+
+ ENDTEST();
+}
+
+bool v8test_evalwithinwith()
+{
+ BEGINTEST();
+
+ HandleScope handle_scope;
+ Persistent<Context> context = Context::New();
+ Context::Scope context_scope(context);
+
+ Local<Object> qmlglobal = Object::New();
+ qmlglobal->Set(String::New("a"), Integer::New(1922));
+ // There was a bug that the "eval" lookup would incorrectly resolve
+ // to the QML global object
+ qmlglobal->Set(String::New("eval"), Integer::New(1922));
+
+#define SOURCE \
+ "(function() { " \
+ " var b = { c: 10 }; " \
+ " with (b) { " \
+ " return eval(\"a\"); " \
+ " } " \
+ "})"
+ Local<Script> script = Script::Compile(String::New(SOURCE), NULL, NULL,
+ Handle<String>(), Script::QmlMode);
+#undef SOURCE
+
+ TryCatch tc;
+ Local<Value> result = script->Run(qmlglobal);
+
+ VERIFY(!tc.HasCaught());
+ VERIFY(result->IsFunction());
+
+ {
+ Local<Value> fresult = Handle<Function>::Cast(result)->Call(context->Global(), 0, 0);
+ VERIFY(!tc.HasCaught());
+ VERIFY(fresult->Int32Value() == 1922);
+ }
+
+cleanup:
+ context.Dispose();
+
+ ENDTEST();
+}
+
+static int userObjectComparisonCalled = 0;
+static bool userObjectComparisonReturn = false;
+static Local<Object> expectedLhs;
+static Local<Object> expectedRhs;
+static bool expectedObjectsCompared = false;
+
+#define SET_EXPECTED(lhs, rhs) { \
+ expectedObjectsCompared = false; \
+ expectedLhs = lhs; \
+ expectedRhs = rhs; \
+}
+
+static bool UserObjectComparison(Local<Object> lhs, Local<Object> rhs)
+{
+ userObjectComparisonCalled++;
+
+ expectedObjectsCompared = (lhs == expectedLhs && rhs == expectedRhs);
+
+ return userObjectComparisonReturn;
+}
+
+inline bool runscript(const char *source) {
+ Local<Script> script = Script::Compile(String::New(source));
+ Local<Value> result = script->Run();
+ return result->BooleanValue();
+}
+
+bool v8test_userobjectcompare()
+{
+ BEGINTEST();
+
+ HandleScope handle_scope;
+ Persistent<Context> context = Context::New();
+ Context::Scope context_scope(context);
+
+ V8::SetUserObjectComparisonCallbackFunction(UserObjectComparison);
+
+ Local<ObjectTemplate> ot = ObjectTemplate::New();
+ ot->MarkAsUseUserObjectComparison();
+
+ Local<Object> uoc1 = ot->NewInstance();
+ Local<Object> uoc2 = ot->NewInstance();
+ context->Global()->Set(String::New("uoc1a"), uoc1);
+ context->Global()->Set(String::New("uoc1b"), uoc1);
+ context->Global()->Set(String::New("uoc2"), uoc2);
+ Local<Object> obj1 = Object::New();
+ context->Global()->Set(String::New("obj1a"), obj1);
+ context->Global()->Set(String::New("obj1b"), obj1);
+ context->Global()->Set(String::New("obj2"), Object::New());
+ Local<String> string1 = String::New("Hello World");
+ context->Global()->Set(String::New("string1a"), string1);
+ context->Global()->Set(String::New("string1b"), string1);
+ context->Global()->Set(String::New("string2"), v8::String::New("Goodbye World"));
+
+ // XXX Opportunity for optimization - don't invoke user callback if objects are
+ // equal.
+#if 0
+ userObjectComparisonCalled = 0; userObjectComparisonReturn = false;
+ VERIFY(true == runscript("uoc1a == uoc1b"));
+ VERIFY(userObjectComparisonCalled == 0);
+#endif
+
+ // Comparing two uoc objects invokes uoc
+ userObjectComparisonCalled = 0;
+ userObjectComparisonReturn = false;
+ VERIFY(false == runscript("uoc1a == uoc2"));
+ VERIFY(userObjectComparisonCalled == 1);
+
+ VERIFY(false == runscript("uoc2 == uoc1a"));
+ VERIFY(userObjectComparisonCalled == 2);
+ userObjectComparisonReturn = true;
+ VERIFY(true == runscript("uoc1a == uoc2"));
+ VERIFY(userObjectComparisonCalled == 3);
+ VERIFY(true == runscript("uoc2 == uoc1a"));
+ VERIFY(userObjectComparisonCalled == 4);
+
+ // != on two uoc object invokes uoc
+ userObjectComparisonCalled = 0;
+ userObjectComparisonReturn = false;
+ VERIFY(true == runscript("uoc1a != uoc2"));
+ VERIFY(userObjectComparisonCalled == 1);
+ VERIFY(true == runscript("uoc2 != uoc1a"));
+ VERIFY(userObjectComparisonCalled == 2);
+ userObjectComparisonReturn = true;
+ VERIFY(false == runscript("uoc1a != uoc2"));
+ VERIFY(userObjectComparisonCalled == 3);
+ VERIFY(false == runscript("uoc2 != uoc1a"));
+ VERIFY(userObjectComparisonCalled == 4);
+
+ // Comparison against a non-object doesn't invoke uoc
+ userObjectComparisonCalled = 0;
+ userObjectComparisonReturn = false;
+ VERIFY(false == runscript("uoc1a == string1a"));
+ VERIFY(userObjectComparisonCalled == 0);
+ VERIFY(false == runscript("string1a == uoc1a"));
+ VERIFY(userObjectComparisonCalled == 0);
+ VERIFY(false == runscript("2 == uoc1a"));
+ VERIFY(userObjectComparisonCalled == 0);
+ VERIFY(true == runscript("uoc1a != string1a"));
+ VERIFY(userObjectComparisonCalled == 0);
+ VERIFY(true == runscript("string1a != uoc1a"));
+ VERIFY(userObjectComparisonCalled == 0);
+ VERIFY(true == runscript("2 != uoc1a"));
+ VERIFY(userObjectComparisonCalled == 0);
+
+ // Comparison against a non-uoc-object still invokes uoc
+ userObjectComparisonCalled = 0;
+ userObjectComparisonReturn = false;
+ VERIFY(false == runscript("uoc1a == obj1a"));
+ VERIFY(userObjectComparisonCalled == 1);
+ VERIFY(false == runscript("obj1a == uoc1a"));
+ VERIFY(userObjectComparisonCalled == 2);
+ userObjectComparisonReturn = true;
+ VERIFY(true == runscript("uoc1a == obj1a"));
+ VERIFY(userObjectComparisonCalled == 3);
+ VERIFY(true == runscript("obj1a == uoc1a"));
+ VERIFY(userObjectComparisonCalled == 4);
+
+ // != comparison against a non-uoc-object still invokes uoc
+ userObjectComparisonCalled = 0;
+ userObjectComparisonReturn = false;
+ VERIFY(true == runscript("uoc1a != obj1a"));
+ VERIFY(userObjectComparisonCalled == 1);
+ VERIFY(true == runscript("obj1a != uoc1a"));
+ VERIFY(userObjectComparisonCalled == 2);
+ userObjectComparisonReturn = true;
+ VERIFY(false == runscript("uoc1a != obj1a"));
+ VERIFY(userObjectComparisonCalled == 3);
+ VERIFY(false == runscript("obj1a != uoc1a"));
+ VERIFY(userObjectComparisonCalled == 4);
+
+ // Comparing two non-uoc objects does not invoke uoc
+ userObjectComparisonCalled = 0;
+ userObjectComparisonReturn = false;
+ VERIFY(true == runscript("obj1a == obj1a"));
+ VERIFY(true == runscript("obj1a == obj1b"));
+ VERIFY(false == runscript("obj1a == obj2"));
+ VERIFY(false == runscript("obj1a == string1a"));
+ VERIFY(true == runscript("string1a == string1a"));
+ VERIFY(true == runscript("string1a == string1b"));
+ VERIFY(false == runscript("string1a == string2"));
+ VERIFY(userObjectComparisonCalled == 0);
+
+ // Correct lhs and rhs passed to uoc
+ userObjectComparisonCalled = 0;
+ userObjectComparisonReturn = false;
+ SET_EXPECTED(uoc1, uoc2);
+ VERIFY(false == runscript("uoc1a == uoc2"));
+ VERIFY(true == expectedObjectsCompared);
+ SET_EXPECTED(uoc2, uoc1);
+ VERIFY(false == runscript("uoc2 == uoc1a"));
+ VERIFY(true == expectedObjectsCompared);
+ SET_EXPECTED(uoc1, uoc2);
+ VERIFY(true == runscript("uoc1a != uoc2"));
+ VERIFY(true == expectedObjectsCompared);
+ SET_EXPECTED(uoc2, uoc1);
+ VERIFY(true == runscript("uoc2 != uoc1a"));
+ VERIFY(true == expectedObjectsCompared);
+ SET_EXPECTED(uoc1, obj1);
+ VERIFY(false == runscript("uoc1a == obj1a"));
+ VERIFY(true == expectedObjectsCompared);
+ SET_EXPECTED(obj1, uoc1);
+ VERIFY(false == runscript("obj1a == uoc1a"));
+ VERIFY(true == expectedObjectsCompared);
+
+cleanup:
+ V8::SetUserObjectComparisonCallbackFunction(0);
+ context.Dispose();
+
+ ENDTEST();
+}
diff --git a/tests/auto/v8/v8test.h b/tests/auto/v8/v8test.h
new file mode 100644
index 0000000..8aa358c
--- /dev/null
+++ b/tests/auto/v8/v8test.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef V8TEST_H
+#define V8TEST_H
+
+#ifdef QT_CORE_LIB
+#include <private/v8.h>
+#else
+#include <v8.h>
+#endif
+
+bool v8test_eval();
+bool v8test_evalwithinwith();
+bool v8test_userobjectcompare();
+bool v8test_externalteardown();
+bool v8test_globalcall();
+
+#endif // V8TEST_H
+
diff --git a/tests/tests.pro b/tests/tests.pro
new file mode 100644
index 0000000..7fbc8a9
--- /dev/null
+++ b/tests/tests.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = auto